package com.mrdeer.common.entity.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.mrdeer.common.base.Converter;
import com.mrdeer.common.entity.app.OrderEntity;
import com.mrdeer.common.entity.beans.PageEntity;
import lombok.*;
import org.springframework.beans.BeanUtils;

/**
 * @Author: xie jianchu
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class OrderEntityDTO extends OrderEntity implements Converter<OrderEntity, OrderEntityDTO> {

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private PageEntity page;

    @Override
    public void convert2Do(OrderEntity orderEntity) {
        BeanUtils.copyProperties(this, orderEntity);
    }

    @Override
    public OrderEntityDTO convert(OrderEntity orderEntity) {
        BeanUtils.copyProperties(orderEntity, this);
        return this;
    }
}
